home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / Sources / Init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-04  |  6.4 KB  |  198 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Program Name:    Stiletto                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        Init.c                                                                        */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1991-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1991-06-30    Chris Halim            Original version                                        */
  15. /*        1995-06-26    Jaakko Railo        Version 2.0                                                */
  16. /*                                                                                                */
  17. /************************************************************************************************/
  18.  
  19. /****************************************** DESCRIPTION ******************************************
  20.  
  21. *************************************************************************************************/
  22.  
  23. /******************************************** HEADERS *******************************************/
  24.  
  25. #include "Fonts.h"
  26. #include "Resources.h"
  27.  
  28. //#include "ISDNToolIntf.h"
  29. #include "Telephones.h"
  30.  
  31. #include "About.h"
  32. #include "CAHandlers.h"
  33. #include "CallBackRoutines.h"
  34. #include "Constants.h"
  35. #include "DNHandlers.h"
  36. #include "Init.h"
  37. #include "LogWindow.h"
  38. #include "ModuleWindow.h"
  39. //#include "RPWindow.h"
  40. #include "Stiletto.h"
  41. #include "TermWindow.h"
  42. #include "TestModule.h"
  43. #include "Utilities.h"
  44.  
  45. /****************************************** DEFINITIONS *****************************************/
  46.  
  47. /****************************************** PROTOTYPES ******************************************/
  48.  
  49. OSErr    SetUpUPPs (void);
  50. OSErr    SetupMenuBar (void);
  51.  
  52. /******************************************** GLOBALS *******************************************/
  53.  
  54. ModalFilterUPP        gAboutFilterUPP;
  55. UserItemUPP            gDrawAboutPictUPP;
  56. UserItemUPP            gDrawVersUPP;
  57. ModalFilterUPP        gStandardFilterUPP;
  58. UserItemUPP            gDrawBoxUPP;
  59. UserItemUPP            gDrawDefaultUPP;
  60. TelephoneCAMsgUPP    gCAMsgHandlerUPP;
  61. TelephoneCAMsgUPP    gCAConfMsgHandlerUPP;
  62. TelephoneDNMsgUPP    gDNMsgHandlerUPP;
  63. TelephoneCAMsgUPP    gCAActiveMsgHandlerUPP;
  64. ControlActionUPP    gVActionProcUPP;
  65. DlgHookYDUPP        gGetDirDialogHookUPP;
  66. ModalFilterYDUPP    gGetDirModalFilterUPP;
  67. //RPCompletionUPP        gRPCompletionRoutineUPP;
  68. TelephoneCAMsgUPP    gAllCAMsgsHandlerUPP;
  69. TelephoneDNMsgUPP    gAllDNMsgsHandlerUPP;
  70. TelephoneTermMsgUPP    gAllTermMsgsHandlerUPP;
  71. TelephoneTermMsgUPP    gTermMsgHandlerUPP;
  72. ModalFilterUPP        gAlertUserFilterUPP;
  73. //PutLineUPP            gPutLineUPP;
  74. EntryPointUPP        gEntryPointUPP;
  75.  
  76. /************************************************************************************************/
  77. /************************************************************************************************/
  78.  
  79.  
  80. #pragma segment Initialize
  81. OSErr    SetUpUPPs (void)
  82. {
  83.     gAboutFilterUPP = NewModalFilterProc (AboutFilterProc);
  84.     if (gAboutFilterUPP != NULL) {
  85.         gDrawAboutPictUPP = NewUserItemProc (DrawAboutPict);
  86.         if (gDrawAboutPictUPP != NULL) {
  87.             gDrawVersUPP = NewUserItemProc (DrawVers);
  88.             if (gDrawVersUPP != NULL) {
  89.                 gStandardFilterUPP = NewModalFilterProc (StandardFilterProc);
  90.                 if (gStandardFilterUPP != NULL) {
  91.                     gDrawBoxUPP = NewUserItemProc (DrawBox);
  92.                     if (gDrawBoxUPP != NULL) {
  93.                         gDrawDefaultUPP = NewUserItemProc (DrawDefault);
  94.                         if (gDrawDefaultUPP != NULL) {
  95.                             gCAMsgHandlerUPP = NewTelephoneCAMsgProc (CAMsgHandler);
  96.                             if (gCAMsgHandlerUPP != NULL) {
  97.                                 gCAConfMsgHandlerUPP = NewTelephoneCAMsgProc (CAConfMsgHandler);
  98.                                 if (gCAConfMsgHandlerUPP != NULL) {
  99.                                     gDNMsgHandlerUPP = NewTelephoneDNMsgProc (DNMsgHandler);
  100.                                     if (gDNMsgHandlerUPP != NULL) {
  101.                                         gCAActiveMsgHandlerUPP = NewTelephoneCAMsgProc (CAActiveMsgHandler);
  102.                                         if (gCAActiveMsgHandlerUPP != NULL) {
  103.                                             gVActionProcUPP = NewControlActionProc (VActionProc);
  104.                                             if (gVActionProcUPP != NULL) {
  105.                                                 gGetDirDialogHookUPP = NewDlgHookYDProc (GetDirDialogHook);
  106.                                                 if (gGetDirDialogHookUPP != NULL) {
  107.                                                     gGetDirModalFilterUPP = NewModalFilterYDProc (GetDirModalFilter);
  108.                                                     if (gGetDirModalFilterUPP != NULL) {
  109.                                             //            gRPCompletionRoutineUPP = NewRPCompletionProc (RPCompletionRoutine);
  110.                                             //            if (gRPCompletionRoutineUPP != NULL) {
  111.                                                             gAllCAMsgsHandlerUPP = NewTelephoneCAMsgProc (AllCAMsgsHandler);
  112.                                                             if (gAllCAMsgsHandlerUPP != NULL) {
  113.                                                                 gAllDNMsgsHandlerUPP = NewTelephoneDNMsgProc (AllDNMsgsHandler);
  114.                                                                 if (gAllDNMsgsHandlerUPP != NULL) {
  115.                                                                     gAllTermMsgsHandlerUPP = NewTelephoneTermMsgProc (AllTermMsgsHandler);
  116.                                                                     if (gAllTermMsgsHandlerUPP != NULL) {
  117.                                                                         gTermMsgHandlerUPP = NewTelephoneTermMsgProc (TermMsgHandler);
  118.                                                                         if (gTermMsgHandlerUPP != NULL) {
  119.                                                                             gAlertUserFilterUPP = NewModalFilterProc (AlertUserFilterProc);
  120.                                                                             if (gAlertUserFilterUPP != NULL) {
  121.                                                                     //            gPutLineUPP = NewPutLineProc (PutLine);
  122.                                                                     //            if (gPutLineUPP != NULL) {
  123.                                                                                     gEntryPointUPP = NewEntryPointProc (EntryPoint);
  124.                                                                                     if (gEntryPointUPP != NULL) {
  125.                                                                                         return (noErr);
  126.                                                                                     }
  127.                                                                     //            }
  128.                                                                             }
  129.                                                                         }
  130.                                                                     }
  131.                                                                 }
  132.                                                             }
  133.                                             //            }
  134.                                                     }
  135.                                                 }
  136.                                             }
  137.                                         }
  138.                                     }
  139.                                 }
  140.                             }
  141.                         }
  142.                     }
  143.                 }
  144.             }
  145.         }
  146.     }
  147.     return (mmInternalError);
  148. }
  149.  
  150.  
  151. #pragma segment Initialize
  152. OSErr    SetupMenuBar (void)
  153. {
  154.     Handle        aHandle;
  155.     
  156.     aHandle = GetNewMBar (rMenuBar);            // Get MBAR resource.
  157.     if (aHandle == nil) {
  158.         AlertUser ("\pUnable to get an MBAR resource !", ResError ());
  159.         return (ResError ());
  160.     }
  161.     else {
  162.         SetMenuBar (aHandle);                        // And set it as the default menu bar.
  163.         DisposHandle (aHandle);                        // Mac creates its own copy !!
  164.         
  165.         AddResMenu (GetMHandle (rAppleMenu), 'DRVR'); // Append all Apple Menu Items into  menu.
  166.         
  167.         AdjustMenus ();                                // Adjust hiliting of menu items.
  168.         DrawMenuBar ();
  169.         
  170.         return (noErr);
  171.     }
  172. }
  173.  
  174.  
  175. #pragma segment Initialize
  176. OSErr     Initialize (void)
  177. {
  178.     OSErr    errCode;
  179.     
  180.     InitGraf(&qd.thePort);
  181.     InitFonts();
  182.     InitWindows();
  183.     InitMenus();
  184.     TEInit();
  185.     InitDialogs( nil );
  186.  
  187.     if ((errCode = SetUpUPPs()) == noErr) {
  188.         if ((errCode = SetupMenuBar ()) == noErr)        // Put the default menu bar on the screen.
  189.             InitCursor();
  190.         
  191.         InitializedAppleEvents ();
  192.     }
  193.     
  194.     return (errCode);
  195. }
  196.  
  197.  
  198.